package com.chongba.feign;

import com.chongba.entity.ResponseMessage;
import com.chongba.entity.Task;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("schedule-service")
public interface ScheduleFeign {

    @PostMapping("/schedule/push")
    ResponseMessage pushTask(@RequestBody Task task);

    @GetMapping("/schedule/poll/{taskType}/{priority}")
    ResponseMessage pollTask(@PathVariable("taskType") int taskType,
                             @PathVariable("priority") int priority);

    @PostMapping("/schedule/cancel/{taskId}")
    ResponseMessage cancelTask(@PathVariable("taskId") Long taskId);

    //对外提供缓存数据刷新接口
    @GetMapping("/schedule/refresh")
    ResponseMessage refresh();

}
